using IM.Easy.Core.ServiceLifetime;
using IM.Easy.Core.Services;
using IM.Easy.Core.Utils;
using IM.Easy.Infrastructure.Query;
using IM.Easy.Entity.System;
using IM.Easy.SystemServices.Dtos;

namespace IM.Easy.SystemServices.IServices
{
    public interface IFolderService : IAppServices<Folder>
    {
        ResourcesDto Root { get; }
        /// <summary>
        /// 创建一个新实体
        /// </summary>
        /// <param name="entity">要创建的实体</param>
        /// <returns>创建后的实体</returns>
        Folder Create(Folder entity);

        /// <summary>
        /// 根据 ID 获取实体
        /// </summary>
        /// <param name="id">实体的唯一标识</param>
        /// <returns>获取的实体</returns>
        Folder GetById(Guid id);

        /// <summary>
        /// 获取所有实体
        /// </summary>
        /// <returns>所有实体的列表</returns>
        PageResponse<Folder> GetPageList(FolderQueryDto query);

        /// <summary>
        /// 更新一个已有的实体
        /// </summary>
        /// <param name="entity">更新后的实体</param>
        /// <returns>更新后的实体</returns>
        bool Update(Folder entity);

        /// <summary>
        /// 根据 ID 删除实体
        /// </summary>
        /// <param name="id">要删除的实体的唯一标识</param>
        /// <returns>操作是否成功</returns>
        bool Delete(params Guid[] key);

        /// <summary>
        /// 删除文件夹下面的文件夹
        /// </summary>
        /// <param name="fid"></param>
        /// <returns></returns>
        void DeleteByFolder(Guid fid);

        /// <summary>
        /// 获取文件夹下面的所有内容
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        ResourcesDto GetContents(FolderQueryDto query);


        /// <summary>
        /// 获取文件夹中所有内容(包含自己)  非递归数据
        /// </summary>
        /// <param name="ids"></param>
        /// <returns></returns>
        List<ResourcesDto> GetSubContents(params Guid[] ids);

        /// <summary>
        /// 获取文件夹中所有内容(包含自己)  非递归数据
        /// </summary>
        /// <param name="ids"></param>
        /// <returns></returns>
        List<ResourcesDto> GetSubContents(FolderQueryDto query);

        /// <summary>
        /// 重命名
        /// </summary>
        /// <param name="id"></param>
        /// <param name="name"></param>
        /// <returns></returns>
        bool Rename(Guid id, string name);
    }
}
